package pack2;
public class pack2demo1 {
    String name;
    int age;
    String sex;

    pack2demo1 (){
        System.out.println("这是packdemo2中的无参构造函数");
    }
    pack2demo1 (String name,int age,String sex){
        this.age=age;
        this.name=name;
        this.sex=sex;
        System.out.println("这是packdemo2中的带有3个参数的构造函数");
    }

    @Override
    public String toString() {
        return "pack1类中从写demo1{" +
                "name='" + name + '\'' +
                "age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }


    public static void main1(String[] args) {
        pack2demo1 demo1 = new pack2demo1();
        pack2demo1 demo2 = new pack2demo1("李四", 18, "男");
    }

    public static void main(String[] args) {
        //dog dog1=new dog("小狗",66,"公的");
        System.out.println(dog.name);
    }
}

class dog{
    public static String name="小鬼子";
    private int  age;
    private String sex;

    public dog(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }
    public static void print(){
        name="狗";
        System.out.println("name");
    }

    @Override
    public String toString() {
        return "dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }
    /* //带有两个参数的构造函数
    public cat(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("这是一个带两个参数的构造函数");
    }*/
}
class cat{
    private String name;
    private int age;
    private String sex;

    public cat() {
        System.out.println("这是一个无参的构造函数");
    }

   /* //带有两个参数的构造函数
    public cat(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("这是一个带两个参数的构造函数");
    }*/
}